<template>
  <div>
    <nav-bar title="项目详情">
    </nav-bar>
    <div class="maxinBox" v-if="projectInfo">
      <van-cell title="项目名称" :value="projectInfo.projectName" />
      <van-cell title="建筑单位" :value="projectInfo.constructionUnit" />
      <van-cell title="设计单位" :value="projectInfo.designerUnit" />
      <van-cell title="施工单位" :value="projectInfo.buildUnit" />
      <div class="marginTop5 fontSize14 backgroundfff" style="padding: 10px 16px;">
        <div class="color999">项目介绍:</div>
        <span v-html="projectInfo.projectOverview">
        </span>
      </div>
      <van-cell class="marginTop5" title="开工时间" :value="projectInfo.commencementTime | formatDate" />
      <van-cell title="竣工时间" :value="projectInfo.completionTime | formatDate" />
      <van-cell title="项目二维码" is-link @click="onProjectCode" />
    </div>
  </div>
</template>

<script>
  import myAPI from '../../../../api/myAPI.js'
  export default {
    data() {
      return {
        projectInfo: null,
        projectId: ''
      }
    },
    methods: {
      // 查询项目详情
      getProjectDetails() {
        myAPI.getProjectDetails(JSON.parse(localStorage.getItem('projectData')).projectId).then(res => {
          this.projectInfo = res.project
        })
      },
      // 查看项目二维码
      onProjectCode () {
        this.$router.push({
          name: 'ProjectCode',
          params: {
            data: this.projectInfo
          }
        })
      }
    },
    mounted() {
      this.getProjectDetails()
    }
  }
</script>
<style scoped lang="scss">
/deep/ .van-cell__value{
  flex: 3;
} 
</style>
